BuffEffect15 = BaseBuffEffect:new();
BuffEffect15.__index = BuffEffect15;

function BuffEffect15:new()
    local object = {};
    setmetatable(object, BuffEffect15);
    return object;
end

function BuffEffect15:action(fight,buff,...)
    local target = buff.target;
    local num = 0;
    local fighters = fight.teams[target.teamIndex].fighters;
    for i=1,#fighters do
        if not FighterManager.isDie(fighters[i]) then
            num = num + 1;
        end
    end

    BaseBuffEffect:resetAttribute(fight,buff);
    local values = decodeJsonStrToTabel(buff.buffBean.f_Value);
    local attribute = {values[2],num/values[1] * values[3]};
    BaseBuffEffect:addAttribute(fight,buff,attribute,1);

    fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 触发场上我方单位增加属性效果，增加属性["..values[1].."]："..(num/values[1]*values[2]));
    return EnumConst.IBuffEffect.RESET;

    --[[    local skillBean = skill.skill.skillBean;
        if skillBean.f_IfATK == EnumConst.SkillTypeEnum.NORMAL_ATTACK then

            local result = FightResult.New();
            local buffvalue = decodeJsonStrToTabel(buff.buffBean.f_Value);

            local damage =  Mathf.Floor(fighter.hp * buffvalue[1]/EnumConst.TEN_THOUSANDTH);
            result.damage = damage;
            fightLog("[EFFECT]Fighter "..fighter.fighterId.." Buff"..buff.modelId.." 触发普攻反噬效果，造成伤害"..damage);
            FightDamageManager.realDamage(fight,fighter,fighter,result,EnumConst.SkillDamageTypeEnum.NORMAL);
            BaseBuffEffect:action(fight,buff,...);
        end
        return EnumConst.IBuffEffect.SUCCESS;]]
end
